//
//  ZCXActivityView.m
//  LoveOfPet
//
//  Created by dllo on 15/11/13.
//  Copyright © 2015年 孔维. All rights reserved.
//

#import "ZCXActivityView.h"
#define HEIGHT  [[UIScreen mainScreen]bounds].size.height / 667
#define WIDTH   [[UIScreen mainScreen]bounds].size.width / 375
@implementation ZCXActivityView
- (void)dealloc{
    [_imageV release];
    [_titleLabel release];
    [_target release];
    [super dealloc];
}
- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.imageV = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height - 25 * HEIGHT)];
        [self addSubview:_imageV];
        
        self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.imageV.frame.size.height - 25 * HEIGHT, _imageV.frame.size.width - 50 * WIDTH, 25 * HEIGHT)];
        
        self.titleLabel.textAlignment = NSTextAlignmentRight;
        self.titleLabel.textColor = [UIColor whiteColor];
        self.titleLabel.shadowColor = [UIColor grayColor];
        self.titleLabel.layer.shadowOpacity = 1;
        self.titleLabel.font = [UIFont systemFontOfSize:20 * WIDTH];
        [_imageV addSubview:_titleLabel];
        [_titleLabel release];
        [_imageV release];
    }
    return self;
}
- (void)addTarget:(id)target action:(SEL)action{
    self.target = target;
    self.action = action;
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
    [self.target performSelector:self.action withObject:self];
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
